package com.zhaodao.dubbo.demo.consumer.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.zhaodao.dubbo.demo.model.User;
import com.zhaodao.dubbo.demo.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 描述:
 * 用户消费端
 *
 * @author brozer
 * @create 2018-11-13 15:41
 */
@RestController
@RequestMapping(value = {"/user"})
@Api(tags = {"用户相关接口"})
public class UserConsumerController {

    @Reference(version = "1.0.0")
    private UserService userService;

    @RequestMapping(value = "/query",method = RequestMethod.GET)
    @ApiOperation(value = "查询用户",httpMethod = "GET")
    @ApiImplicitParam(paramType = "header",name = "Authorization",value = "身份认证Token")
    public User query(@RequestParam(name = "name") @ApiParam("用户名") String name){
        User user = userService.queryByName(name);
        return user;
    }
}
